/**
 * <copyright>
 * </copyright>
 *
 */
package org.xtext.example.mydsl.myDsl.impl;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import org.xtext.example.mydsl.myDsl.EnabledLess;
import org.xtext.example.mydsl.myDsl.Menor;
import org.xtext.example.mydsl.myDsl.MyDslPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Enabled Less</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.EnabledLessImpl#getBool <em>Bool</em>}</li>
 *   <li>{@link org.xtext.example.mydsl.myDsl.impl.EnabledLessImpl#getMenor <em>Menor</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class EnabledLessImpl extends AccionImpl implements EnabledLess
{
  /**
   * The cached value of the '{@link #getBool() <em>Bool</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getBool()
   * @generated
   * @ordered
   */
  protected org.xtext.example.mydsl.myDsl.Boolean bool;

  /**
   * The cached value of the '{@link #getMenor() <em>Menor</em>}' containment reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getMenor()
   * @generated
   * @ordered
   */
  protected Menor menor;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected EnabledLessImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return MyDslPackage.Literals.ENABLED_LESS;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public org.xtext.example.mydsl.myDsl.Boolean getBool()
  {
    return bool;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetBool(org.xtext.example.mydsl.myDsl.Boolean newBool, NotificationChain msgs)
  {
    org.xtext.example.mydsl.myDsl.Boolean oldBool = bool;
    bool = newBool;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MyDslPackage.ENABLED_LESS__BOOL, oldBool, newBool);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setBool(org.xtext.example.mydsl.myDsl.Boolean newBool)
  {
    if (newBool != bool)
    {
      NotificationChain msgs = null;
      if (bool != null)
        msgs = ((InternalEObject)bool).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MyDslPackage.ENABLED_LESS__BOOL, null, msgs);
      if (newBool != null)
        msgs = ((InternalEObject)newBool).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MyDslPackage.ENABLED_LESS__BOOL, null, msgs);
      msgs = basicSetBool(newBool, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.ENABLED_LESS__BOOL, newBool, newBool));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Menor getMenor()
  {
    return menor;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public NotificationChain basicSetMenor(Menor newMenor, NotificationChain msgs)
  {
    Menor oldMenor = menor;
    menor = newMenor;
    if (eNotificationRequired())
    {
      ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, MyDslPackage.ENABLED_LESS__MENOR, oldMenor, newMenor);
      if (msgs == null) msgs = notification; else msgs.add(notification);
    }
    return msgs;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setMenor(Menor newMenor)
  {
    if (newMenor != menor)
    {
      NotificationChain msgs = null;
      if (menor != null)
        msgs = ((InternalEObject)menor).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - MyDslPackage.ENABLED_LESS__MENOR, null, msgs);
      if (newMenor != null)
        msgs = ((InternalEObject)newMenor).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - MyDslPackage.ENABLED_LESS__MENOR, null, msgs);
      msgs = basicSetMenor(newMenor, msgs);
      if (msgs != null) msgs.dispatch();
    }
    else if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, MyDslPackage.ENABLED_LESS__MENOR, newMenor, newMenor));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs)
  {
    switch (featureID)
    {
      case MyDslPackage.ENABLED_LESS__BOOL:
        return basicSetBool(null, msgs);
      case MyDslPackage.ENABLED_LESS__MENOR:
        return basicSetMenor(null, msgs);
    }
    return super.eInverseRemove(otherEnd, featureID, msgs);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case MyDslPackage.ENABLED_LESS__BOOL:
        return getBool();
      case MyDslPackage.ENABLED_LESS__MENOR:
        return getMenor();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case MyDslPackage.ENABLED_LESS__BOOL:
        setBool((org.xtext.example.mydsl.myDsl.Boolean)newValue);
        return;
      case MyDslPackage.ENABLED_LESS__MENOR:
        setMenor((Menor)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.ENABLED_LESS__BOOL:
        setBool((org.xtext.example.mydsl.myDsl.Boolean)null);
        return;
      case MyDslPackage.ENABLED_LESS__MENOR:
        setMenor((Menor)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case MyDslPackage.ENABLED_LESS__BOOL:
        return bool != null;
      case MyDslPackage.ENABLED_LESS__MENOR:
        return menor != null;
    }
    return super.eIsSet(featureID);
  }

} //EnabledLessImpl
